package com.balance.anole.client.retail.payment;

import java.math.BigDecimal;

import com.balance.anole.common.to.CodeLookTO;
import com.balance.anole.utils.Constants;

public class CashPayment extends Payment {

	public CashPayment(BigDecimal paid, BigDecimal needPay) {
		super(paid, needPay);
		setPaymentMode(new CodeLookTO(Constants.CODE_TYPE_PAYMENT_TYPE, "C"));
	}

	public BigDecimal pay(){
		return paid.subtract(needPay);
	}

	public int getPriority(){
		return 100;
	}

	@Override
	public String getPaymentDesc() {
		return "现金";
	}

	@Override
	public BigDecimal getRealPaidValue() {
		//cash: change exists.
		return paid.compareTo(needPay) < 0 ? paid : needPay;
	}
}
